<?php
    $category_name = ($this->category->category_content_name)?$this->category->category_content_name:$this->category->category_admin_name;
    $this->headTitle($category_name .' @ kinhdoanhdientu.vn');

    $this->headLink()
        ->appendStylesheet($this->APP_STATIC_SERVER . '/js/jquery.ui/themes/base/ui.core.css')
        ->appendStylesheet($this->APP_STATIC_SERVER . '/js/jquery.ui/themes/base/ui.resizable.css')
        ->appendStylesheet($this->APP_STATIC_SERVER . '/js/jquery.ui/themes/base/ui.dialog.css')
        ->appendStylesheet($this->APP_STATIC_SERVER . '/js/jquery.ui/themes/base/ui.theme.css')
        ;

    $this->headScript()
        ->appendFile($this->APP_STATIC_SERVER . '/js/jquery.ui/ui.core.js')
        ->appendFile($this->APP_STATIC_SERVER . '/js/jquery.ui/ui.draggable.js')
        ->appendFile($this->APP_STATIC_SERVER . '/js/jquery.ui/ui.droppable.js')
        ->appendFile($this->APP_STATIC_SERVER . '/js/jquery.ui/ui.resizable.js')
        ->appendFile($this->APP_STATIC_SERVER . '/js/jquery.ui/ui.dialog.js')
        ;
?>
<style>
    .col_50l{
        float:left;
        width:48%;
    }
    .col_50r{
        float:right;
        width:48%;
    }
    .subrow{
        padding-bottom:10px;
        display:table;
        width:100%;
    }
    .col_70l{
        float:left;
        width:69.2%;
    }
    .col_30r{
        float:right;
        width:30%;
    }
    .col_30l{
        float:left;
        width:29%;
    }
    .col_70r{
        float:right;
        width:70%;
    }
    .webwidget_vertical_menu li{
        margin-left:0px;
    }
    .caption_box{
        margin-bottom:5px; background:#EFEDED none repeat;
    }
    .caption_box span{
        padding:8px;
        text-transform:uppercase;
    }
    .box_33l{
        float:left;
        width:33.3%;
        background:#EFEDED none repeat;
    }
    .subbox_33l{
        background:#FFFFFF;
        margin:5px 0px 10px 5px;
        padding:5px
    }

    ul.sub_menu li ul{
        width:100%;
        display:table;
        margin:0;
    }
    ul.sub_menu li.menu_item{
        float: left;
        width: 23%;
    }
</style>
<?php
    $skin_url = $this->APP_STATIC_SERVER . '/skins/'. $this->APP_TEMPLATE . '/'. $this->APP_SKIN;
?>
<div class="grid_12 pb10">
    <!--Search form-->
    <?php echo $this->widget('shop','searchform',array()); ?>
    <!--End search form-->
</div>
<div class="grid_12">
    <div class="col_70l">
        <!--Navigation-->
        <?php echo $this->widget('shop','breadcrumb',array()); ?>
        <!--End navigation-->

        <div class="subcolumns pb10">
            <!--sub menu-->
            <?php
                $subCategory = $this->dirSubCat;
            ?>
            <?php if(count($subCategory)):?>
            <ul class="sub_menu">
                <?php $index =0; foreach($subCategory as $category):?>
                    <?php
                        $arrRoute = array(
                            'category_id'  => $category->category_id,
                            'slug'         => ($category->slug)?$category->slug:Tomato_Utility_String::removeSign($category->category_admin_name, '-', true),
                        );

                        $arrNumItem = isset($this->arrNumItem[$category->category_id])?$this->arrNumItem[$category->category_id]:0;
                    ?>
                    <?php if($index%4 == 0):?><li><ul><?php endif;?>
                        <li class="menu_item"><a href="<?php echo $this->url($arrRoute, 'shop_product_sub_categories');?>"><?php echo ($category->category_content_name)?$category->category_content_name:$category->category_admin_name?> (<?php echo $arrNumItem;?>)</a></li>
                    <?php $index++; if($index%4 == 0):?></ul></li><?php endif;?>
                <?php endforeach;?>
                <?php if($index%4 != 0):?></ul></li><?php endif;?>
            </ul>
            <?php endif;?>
            <!--end sub menu-->
        </div>
        <div class="subcolumns pb10">
            <!--product list-->
            <div class="caption_box icon_title">
                <span><?php echo $category_name;?></span>
            </div>
            <div class="pb10">(<?php echo $this->translator('product_number_item');?>: <b><?php echo $this->numProduct;?></b>)</div>
            <?php $i=0; foreach ($this->products as $product):?>
            <?php
                /**
                * Check image exist directory
                **/
                $file = $product->product_image;				
                $path = str_replace($this->APP_STATIC_SERVER,getcwd(),$file);
                $file = Tomato_Helper_Helper::checkFile($path, $file, '_thumbnail');
                $urlImage = $file?$file:null;
                /**
                * Category follow product
                **/
                $objCategory = $this->arrPC[$product->product_id];

                /**
                * Enterprise follow product
                **/
                $objEnterprise = $this->arrPE[$product->product_id];

                /**
                * Param url detail
                **/
                $arrRouteDetail = array(
                    'enterprise_id' => $objEnterprise->id,
                    'enterprise_name' => Tomato_Utility_String::removeSign($objEnterprise->company_name_en, '-', true),
                    'cat' => $objCategory->category_id,
                    'slug' => ($objCategory->slug)?$objCategory->slug:Tomato_Utility_String::removeSign($objCategory->category_admin_name, '-', true),
                    'product_id' => $product->product_id,
                    'pro_slug' => ($product->slug)?$product->slug:Tomato_Utility_String::removeSign($product->product_admin_name, '-', true),
                );
            ?>
            <?php if($i%2==0):?>
            <div class="subrow">
            <?php endif;?>
                <div class="<?php if($i%2==0):?>col_50l<?php else:?>col_50r<?php endif;?>">
                    <div class="subcolumns_oldgecko">
                        <a href="<?php echo $this->url($arrRouteDetail,'shop_product_detail');?>"><span class="title"><?php echo ($product->product_content_name)?$product->product_content_name:$product->product_admin_name;?></span></a>
                    </div>
                    <div class="subcolumns_oldgecko" style="padding-bottom:5px;">
                        <div class="geckol" style="padding-right:5px;">
                            <?php if($urlImage):?>
                                <a href="<?php echo $this->url($arrRouteDetail,'shop_product_detail');?>"><img class="item_img" width="95" src="<?php echo $urlImage;?>" /></a>
                            <?php else:?>
                                <a href="<?php echo $this->url($arrRouteDetail,'shop_product_detail');?>"><img class="item_img" src="<?php echo $this->baseUrl(); ?>/skins/bizprofile/default/html/images/img.jpg" /></a>
                            <?php endif;?>
                        </div>
							<!--Hung sua:
							Muc dich:Cho an neu ko co du lieu do ve
							-->
                        <div class="geckor">
                            <div style="text-align:justify">
                                <?php echo strip_tags(Tomato_Helper_Helper::substring($product->product_content_description, 70));?>
                            </div>
                            <div>
                                <?php echo $this->translator('front_product_price');?>:
                                <strong><?php echo $product->product_price;?> <?php echo $product->product_price_currency;?></strong>
                            </div>
							<?php if($product->product_shipping_price_1 > 0):?>
                            <div style="width:50%; float:left;">
                                <i><?php echo $this->translator('front_product_shipping_price')?></i><br />
                                <strong><?php echo $product->product_shipping_price_1;?> <?php echo $product->product_price_currency;?></strong>
                            </div>
							<?php endif;?>
							<?php if($product->product_quantity > 0):?>
                            <div style="width:50%; float:left;">
                                <?php echo $this->translator('front_product_source')?></i><br />
                                <strong><?php echo $product->product_quantity;?></strong> <?php echo $this->translator('front_product_source_guide');?>
                            </div>
							<?php endif;?>
                        </div>
						<!--ket thuc code sua-->
						
                    </div>
                </div>
            <?php $i++; if($i%2==0):?>
            </div>
            <?php endif;?>
            <?php endforeach;?>
            <?php if($i%2!=0):?>
            </div>
            <?php endif;?>

            <?php if($this->numProduct > 0):?>
                <div class="b_a_paginator"><?php echo $this->paginator()->slide($this->paginator, $this->paginatorOptions);?></div>
            <?php endif;?>
            <!--end product list-->
        </div>
    </div>
    <div class="col_30r">
        <!--Most viewed box-->
        <?php echo $this->widget('shop','mostviewed',array()); ?>

        <!--Most buy box-->
        <?php echo $this->widget('shop','mostbuy',array()); ?>
    </div>
</div>
<div class="grid_12">
    <?php echo $this->widget('bizprofile','contact',array()); ?>
</div>